#pragma once

#include <iostream>
#include <cmath>
#include <iomanip>
#include <vector>
#include <math.h>
#include <string.h>

#define GET_ELEMENT(from,what) (what<from.number.size()?from.number[what]:0)*(from.isNegative?-1:1)
#define ABS(from) LongInt(from.isNegative?-1:1)*from

using namespace std;

class LongInt
{
private:
	
	bool isNegative;
	void trim();
	void divide(const LongInt& left, const LongInt& right, LongInt& result, LongInt& subresult);

public: 
	vector<short int> number; 
	LongInt():
	  number(vector<short int>(1,0)), 
	  isNegative(false){}
	LongInt(const long int& original);
	LongInt(const LongInt& original);
	~LongInt(){}

	bool operator> (const LongInt&);
	bool operator< (const LongInt&);
	bool operator>=(const LongInt&);
	bool operator<=(const LongInt&);
	bool operator==(const LongInt&);

	LongInt operator+ (const LongInt&);
	LongInt operator- (const LongInt&);
	LongInt operator* (const LongInt&);
	LongInt operator/ (const LongInt&);
	LongInt operator= (const LongInt&);
	LongInt operator% (const LongInt&);
	void Add (const int&);
	friend ostream& operator<<(ostream&, const LongInt&);
	int ToInt();
};